package com.ruoyi.work.service;

import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.common.enums.ICommonEnum;
import com.ruoyi.work.domain.WorkMediaWb;
import com.ruoyi.work.domain.WorkMediaWx;

import java.math.BigDecimal;
import java.util.function.Function;
public enum PriceType implements ICommonEnum {
    WDIRECT("1", "微任务直发价",(m)->{return ((WorkMediaWb)m).getwDirectPrice();}),
    WFORWARD("2", "微任务转发价",(m)->{return ((WorkMediaWb)m).getwForwardPrice();}),
    DIRECT("3", "直发价",(m)->{return ((WorkMediaWb)m).getDirectPrice();}),
    FORWARD("4", "转发价",(m)->{return ((WorkMediaWb)m).getForwardPrice();}),
    LEAD("5","头条",(m)->{return ((WorkMediaWx)m).getLeadPrice();}),
    SECOND("6","次条",(m)->{return ((WorkMediaWx)m).getSecondPrice();});



    private final String code;
    private final String info;
    private final Function<BaseEntity,BigDecimal> fn;

    PriceType(String code, String info,Function<BaseEntity,BigDecimal> fn)
    {
        this.code = code;
        this.info = info;
        this.fn = fn;
    }

    public String getCode()
    {
        return code;
    }

    public String getInfo()
    {
        return info;
    }

    public Function<BaseEntity,BigDecimal> getFunction(){
        return fn;
    }


}
